<template>
  <div class="member-privileges">
    <!-- 顶部导航 -->
    <div class="nav-header">
      <div class="back-btn" @click="router.back()">
        <span class="back-icon">←</span>
      </div>
      <h1>会员特权</h1>
    </div>

    <!-- 会员卡片区域 -->
    <div class="member-card-section">
      <div class="member-card">
        <div class="card-content">
          <div class="card-logo">
            <span class="logo-text">CELERY</span>
          </div>
          <div class="card-info">
            <div class="level">
              <span class="level-value">银卡会员</span>
              <span class="level-label">当前等级</span>
            </div>
            <div class="points">
              <span class="point-value">286</span>
              <span class="point-label">积分</span>
            </div>
          </div>
          <div class="card-bottom">
            <span class="card-number">6235 **** **** 3291</span>
          </div>
        </div>
      </div>
    </div>

    <!-- 特权权益列表 -->
    <div class="privileges-section">
      <h2>专属特权</h2>
      <div class="privileges-grid">
        <div v-for="privilege in privileges" :key="privilege.title" class="privilege-item">
          <div class="privilege-icon" :style="{ backgroundColor: privilege.color }">
            <span>{{ privilege.icon }}</span>
          </div>
          <h3>{{ privilege.title }}</h3>
          <p>{{ privilege.description }}</p>
        </div>
      </div>
    </div>

    <!-- 成长体系说明 -->
    <div class="growth-system">
      <h2>会员成长体系</h2>
      <div class="level-progress">
        <div class="progress-bar">
          <div class="progress-fill" :style="{ width: '60%' }"></div>
          <div class="progress-markers">
            <div class="marker" v-for="level in levels" :key="level.name">
              <div class="marker-dot" :class="{ active: level.active }"></div>
              <span class="marker-label">{{ level.name }}</span>
              <span class="points-required">{{ level.points }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'

const router = useRouter()

// 特权权益数据
const privileges = [
  {
    icon: '🎁',
    title: '生日礼券',
    description: '生日当月可获得专属优惠券',
    color: '#FFD700'
  },
  {
    icon: '💰',
    title: '专享折扣',
    description: '全场商品9折优惠',
    color: '#FF6B6B'
  },
  {
    icon: '⭐',
    title: '积分加速',
    description: '消费享1.2倍积分',
    color: '#4ECDC4'
  },
  {
    icon: '🎯',
    title: '专属活动',
    description: '优先参与新品品鉴',
    color: '#45B7D1'
  }
]

// 会员等级数据
const levels = [
  { name: '普通会员', points: '0分', active: true },
  { name: '银卡会员', points: '500分', active: true },
  { name: '金卡会员', points: '1000分', active: false }
]
</script>

<style scoped>
.member-privileges {
  padding-bottom: 24px;
  background-color: #f8f9fa;
  min-height: 100vh;
  max-width: 430px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.nav-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, #42b883 0%, #35495e 100%);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  color: white;
  height: 50px;
}

.back-icon {
  font-size: 24px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
  margin-right: 16px;
}

.back-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}


.nav-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  flex: 1;
  text-align: center;
}

/* 会员卡片样式 */
.member-card-section {
  margin-top: 80px;
  padding: 20px;
}

.member-card {
  padding: 6px;
  background: linear-gradient(45deg, #1a1a1a, #333333);
  border-radius: 24px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.member-card:hover {
  transform: translateY(-5px);
}

.card-content {
  border-radius: 20px;
  padding: 24px;
  background-color: #222222;
  color: white;
  position: relative;
  overflow: hidden;
}

.card-logo {
  margin-bottom: 20px;
}

.logo-text {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #ffd700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.card-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
}

.points, .level {
  display: flex;
  flex-direction: column;
}

.point-value, .level-value {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.point-label, .level-label {
  font-size: 14px;
  opacity: 0.9;
}

.card-number {
  font-size: 16px;
  letter-spacing: 3px;
  opacity: 0.8;
}

/* 特权权益列表样式 */
.privileges-section {
  padding: 20px;
  background: white;
  border-radius: 20px;
  margin: 0 20px 24px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.privileges-section h2 {
  margin: 0 0 20px 0;
  font-size: 20px;
  font-weight: 600;
  color: #1a1a1a;
}

.privileges-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.privilege-item {
  text-align: center;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 16px;
  transition: transform 0.2s ease;
}

.privilege-item:hover {
  transform: translateY(-3px);
}

.privilege-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.privilege-icon span {
  font-size: 24px;
}

.privilege-item h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
}

.privilege-item p {
  margin: 0;
  font-size: 14px;
  color: #666;
  line-height: 1.4;
}

/* 成长体系样式 */
.growth-system {
  padding: 20px;
  background: white;
  border-radius: 20px;
  margin: 0 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.growth-system h2 {
  margin: 0 0 20px 0;
  font-size: 20px;
  font-weight: 600;
  color: #1a1a1a;
}

.level-progress {
  padding: 20px 0;
}

.progress-bar {
  position: relative;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  margin-bottom: 40px;
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-markers {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
}

.marker {
  text-align: center;
  position: relative;
}

.marker-dot {
  width: 16px;
  height: 16px;
  background: #e5e7eb;
  border-radius: 50%;
  margin: 0 auto 8px;
  border: 3px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.marker-dot.active {
  background: #4f46e5;
}

.marker-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.points-required {
  display: block;
  font-size: 12px;
  color: #666;
}
</style>